package top.icsat.android.template

import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import top.icsat.android.echo.AndroidNative

class WelcomeActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)


        setContentView(R.layout.activity_welcome)

        val btnInit: Button = findViewById(R.id.btn)
        val btnSign: Button = findViewById(R.id.btn_sign)
        val text: TextView = findViewById(R.id.text)

        text.text = AndroidNative.navStr()

        btnSign.setOnClickListener {
            val sign = AndroidNative.sign("nice!")
            text.text = if (sign.isNullOrEmpty()) "empty" else sign
        }

        btnInit.setOnClickListener {
            val init = AndroidNative.init(it.context.applicationContext)
            text.text = "init:$init"
        }

    }

}